Qiskit utils
Utility functions to generate common quantum circuits and have a convenient visualization of the quantum state
- qmatchatea.utils.qk_utils.GHZ_qiskit(circ)[source]
Generates a GHZ state in the quantum circuit circ composed by n qubits. Acts in place.
Parameters
- circ: Quantum Circuit
The quantum circuit in the state ‘00…0’ where to build the GHZ
Returns
- None: None
Acts in place.
- qmatchatea.utils.qk_utils.QFT_qiskit(circuit, nn)[source]
Apply the QFT to a qiskit quantum circuit circuit in a recursive way
Parameters
- circuitquantum circuit
quantum circuit where we want to apply the QFT
- nnint
number of qubits in circuit
Returns
- None: None
Acts in place
- qmatchatea.utils.qk_utils.W_qiskit(circ)[source]
Generates a W state in the quantum circuit circ composed by n qubits. Acts in place.
Parameters
- circ: Quantum Circuit
The quantum circuit in the state ‘00…0’ where to build the W
Returns
- None: None
Acts in place.
- qmatchatea.utils.qk_utils.get_index(qc, qubit)[source]
Get the index of the qubit/bit of a quantum circuit.
Parameters
- qcQuantumCircuit
qiskit quantum circuit where the qubit is defined
- qubitQubit/Bit
Qubit of which you want to know the index
Returns
- int
Index of the qubit
- qmatchatea.utils.qk_utils.qiskit_get_statevect(qc)[source]
Returns the statevector of the qiskit quantum circuit qc
Parameters
- qc: Quantum circuit
Quantum circuit of which we want the statevector
Returns
- st: array_like
Statevector of the quantum circuit after the application of the reverse operation on the qubit’s ordering